var exec = require('cordova/exec');

var CloudCall = function () { };


/// h5调用插件事件
CloudCall.prototype.cloudCallNativeServer = function (success, failure, obj) {
  console.log('========CloudCall.cloudCallNativeServer', success, failure, obj);

  exec(success, failure, "CloudCall", "cloudCallNativeServer", [obj.action, obj.params]);
}

/// 处理插件调用h5回调
CloudCall.prototype.nativeCallBackAction = function (success, failure) {
  console.log('========CloudCall.nativeCallBackAction', success, failure);

  exec(success, failure, "CloudCall", "nativeCallBackAction");
}

//Plug in to Cordova
cordova.addConstructor(function () {

  if (!window.Cordova) {
    window.Cordova = cordova;
  };

  if (!window.plugins) window.plugins = {};
  window.plugins.CloudCall = new CloudCall();
});